package com.hongmeng.teamwork.utils;

import com.lark.oapi.core.request.RequestOptions;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

public class FeishuUtil {

    public static RequestOptions getRequestOptionsByRequest(HttpServletRequest request) {
        String accessToken = request.getHeader("accessToken");
        return getRequestOptionsByAccessToken(accessToken);
    }

    public static RequestOptions getRequestOptionsByAccessToken(String accessToken) {
        return RequestOptions.newBuilder()
                .tenantAccessToken(accessToken)
                .build();
    }

    public static RequestOptions getRequestOptions(Map<String, List<String>> header, String accessToken) {
        return RequestOptions.newBuilder()
                .headers(header)
                .tenantAccessToken(accessToken)
                .build();
    }
}
